.class public Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;
.super Landroid/widget/ImageView;
.source "ESScreenFitImageView.java"


# instance fields
.field private a:Landroid/graphics/Bitmap;

.field private b:I

.field private c:I

.field private d:Z

.field private e:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    .line 2
    invoke-direct {p0}, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->a()V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1

    const/4 v0, 0x0

    .line 3
    invoke-direct {p0, p1, p2, v0}, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0

    .line 4
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 5
    invoke-direct {p0}, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->a()V

    return-void
.end method

.method private a()V
    .locals 1

    const/4 v0, 0x1

    .line 1
    iput-boolean v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->d:Z

    .line 2
    iget-boolean v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->e:Z

    if-eqz v0, :cond_0

    .line 3
    invoke-direct {p0}, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->c()V

    const/4 v0, 0x0

    .line 4
    iput-boolean v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->e:Z

    :cond_0
    return-void
.end method

.method private b()V
    .locals 13

    .line 1
    invoke-virtual {p0}, Landroid/widget/ImageView;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v0

    iget v0, v0, Landroid/util/DisplayMetrics;->widthPixels:I

    .line 2
    invoke-virtual {p0}, Landroid/widget/ImageView;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v1

    iget v1, v1, Landroid/util/DisplayMetrics;->heightPixels:I

    .line 3
    iget v2, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->c:I

    .line 4
    iget v3, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->b:I

    int-to-double v4, v0

    const-wide/high16 v6, 0x3ff0000000000000L    # 1.0

    .line 5
    invoke-static {v4, v5}, Ljava/lang/Double;->isNaN(D)Z

    mul-double v4, v4, v6

    int-to-double v8, v3

    invoke-static {v8, v9}, Ljava/lang/Double;->isNaN(D)Z

    div-double/2addr v4, v8

    int-to-double v2, v2

    .line 6
    invoke-static {v2, v3}, Ljava/lang/Double;->isNaN(D)Z

    mul-double v10, v2, v4

    int-to-double v0, v1

    cmpl-double v12, v10, v0

    if-lez v12, :cond_0

    .line 7
    invoke-static {v0, v1}, Ljava/lang/Double;->isNaN(D)Z

    mul-double v0, v0, v6

    invoke-static {v2, v3}, Ljava/lang/Double;->isNaN(D)Z

    div-double v4, v0, v2

    .line 8
    :cond_0
    invoke-static {v2, v3}, Ljava/lang/Double;->isNaN(D)Z

    mul-double v2, v2, v4

    double-to-int v0, v2

    .line 9
    invoke-static {v8, v9}, Ljava/lang/Double;->isNaN(D)Z

    mul-double v4, v4, v8

    double-to-int v1, v4

    .line 10
    invoke-virtual {p0}, Landroid/widget/ImageView;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v2

    .line 11
    iput v1, v2, Landroid/view/ViewGroup$LayoutParams;->width:I

    .line 12
    iput v0, v2, Landroid/view/ViewGroup$LayoutParams;->height:I

    .line 13
    invoke-virtual {p0, v2}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    return-void
.end method

.method private c()V
    .locals 1

    .line 1
    iget-boolean v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->d:Z

    if-nez v0, :cond_0

    const/4 v0, 0x1

    .line 2
    iput-boolean v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->e:Z

    return-void

    .line 3
    :cond_0
    iget-object v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->a:Landroid/graphics/Bitmap;

    if-nez v0, :cond_1

    return-void

    .line 4
    :cond_1
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v0

    iput v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->c:I

    .line 5
    iget-object v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->a:Landroid/graphics/Bitmap;

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v0

    iput v0, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->b:I

    .line 6
    invoke-virtual {p0}, Landroid/widget/ImageView;->invalidate()V

    return-void
.end method


# virtual methods
.method public setImageBitmap(Landroid/graphics/Bitmap;)V
    .locals 0

    .line 1
    invoke-super {p0, p1}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V

    .line 2
    iput-object p1, p0, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->a:Landroid/graphics/Bitmap;

    .line 3
    invoke-direct {p0}, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->c()V

    .line 4
    invoke-direct {p0}, Lcom/estrongs/android/pop/esclasses/ESScreenFitImageView;->b()V

    return-void
.end method
